小编Alf*_*ara的帖子

如何在R中的数据框中找到列的最高值?

我有以下数据框,我称之为臭氧:

   Ozone Solar.R Wind Temp Month Day
1     41     190  7.4   67     5   1
2     36     118  8.0   72     5   2
3     12     149 12.6   74     5   3
4     18     313 11.5   62     5   4
5     NA      NA 14.3   56     5   5
6     28      NA 14.9   66     5   6
7     23     299  8.6   65     5   7
8     19      99 13.8   59     5   8
9      8      19 20.1   61     5   9
Run Code Online (Sandbox Code Playgroud)

我想提取的最高值ozone,Solar.R,Wind...

此外,如果可能,我将如何Solar.R按降序对此数据框进行排序或任何列 …

r max

56
推荐指数
4
解决办法
19万
查看次数

如何使用strcpy()函数将字符存储到char指针中

我试图找出为什么我不能通过使用strcpy()命令将字符存储到我的char指针.当我运行下面的代码时,我得到一个seg错误.

#include <stdio.h> 
#include <string.h>                                                                  

int main(int argc, const char *argv[])                                               
{                                                                                    
   char *str1, *str2;                                                               
   int ret;                                                                         

   strcpy(str1, "abcdefg"); // stores string into character array str1              
   strcpy(str2, "abcdefg");                                                         

   printf("contents of %s \n", str1);                                               

   ret = strncmp(str1, str2, strlen(str2)); /* compares str1 to str2 */             

   if (ret > 0) {                                                                   
       printf("str1 is less than str2\n");                                          
  }                                                                                
  else if (ret < 0) {                                                              
      printf("str2 is less than str1\n");                                          
  }                                                                                
  else if (ret == 0) {                                                             
      printf("str1 is equal to str2\n");                                           
  }                                                                                

  return …
Run Code Online (Sandbox Code Playgroud)

c segmentation-fault

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c ×1

max ×1

r ×1

segmentation-fault ×1